<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>更新</title>
    <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
</head>
<body>
<form>
    <input type="text" name="id" id="id" disabled th:value="${id}">
    <input type="text" name="name" id="name">
    <input type="number" name="age" id="age">
    <input type="date" name="day" id="day">
    <button type="button" onclick="handleSubmit ()">提交</button>

    <script>
        function handleSubmit(){
            $.ajax({
                url:"/user/update",
                type:"post",
                data:{
                    id:$("#id").val(),
                    name: $("#name").val(),
                    age: $("#age").val(),
                    addr: $("#addr").val()
                },
                success(res){
                    if(res.success){
                        alert(res.msg)
                        window.location.href="/user/index";
                    }else{
                        alert(res.msg)
                    }
                }
            })
        }
    </script>
</form>
</body>
</html>